// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import axios from 'axios'
import routers from './routers'
import VueRouter from 'vue-router';
Vue.prototype.$axios = axios;

Vue.config.productionTip = false

// 自定义指令,在show-blogs中有用到
Vue.directive('theme',{
  bind(el,binding,vnode){
    if(binding.value =="wide"){
      el.style.maxWidth = '1260px';
    }else if(binding.value =="narrow"){
      el.style.maxWidth = "800x";
    }
    // 如果Binding有指定的参数
    if(binding.arg ==  "cloumn"){
      el.style.background = "#6677cc";
      el.style.padding ="20px";
    }
  }
})
// 自定义过滤器
Vue.filter('snippet',(value)=>{
  return value.slice(0,100)+'...';
})
Vue.use(VueRouter)
// 把routers-->index.js的路由在Main.js中实例
const router = new VueRouter({
  // mode:'history',
  routes:routers
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
